<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.*,
						org.apache.commons.logging.Log, 
						org.apache.commons.logging.LogFactory,
						com.ophelisis.common.util.*,
						com.ophelisis.common.consts.*,
						com.ophelisis.actions.system.*"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="page" uri="/tld/xdp-page.tld"%>

<c:choose>
	<c:when test="${totalCnt != '' && !empty totalCnt}">
		<c:set var="totalCnt" value="${totalCnt}" />
	</c:when>
	<c:otherwise>
		<c:set var="totalCnt" value="0" />
	</c:otherwise>
</c:choose>

<script>
$(document).ready(function() {
	if (checkUserAuth() < 2) {
		$("#btnAdd").hide();
	}
});
</script>
<!-- Title Start -->
<%@ include file="/WEB-INF/jsp/common/resultMessageLocal.jsp"%>
<div id="formtitle">
	<input type="hidden" id="loadCheck" name="loadCheck" value="OK" />
	<form id="searchForm" name="searchForm" method="post">
		<table id="search" class="searchstyle1">
			<tr>
				<td class="title1">사용자 이름</td>
                <td class="input1"><input class="in3 width_200p" id="searchVal1" name="searchVal1" type="text" value="${searchVal1}" /></td>
                <td class="btn1"><img id="searchBtn" src="images/btn/search.gif" class="clickable" /></td>
			</tr>
		</table>
	</form>
	<div>
		<div class="flo_r pdt10 pdb5"><img src="images/btn/btn_add02.gif" id="btnAdd" class="clickable" onclick="javascript:pmModule.setAdd();" /></div>
	</div>
	<table id="list" class="liststyle1 sortable">
		<colgroup>
			<col width="100" />
			<col width="" />
			<col width="120" />
			<col width="160" />
			<col width="160" />
			<col width="60" />
			<col width="60" />
		</colgroup>
		<tr>
			<th id ="0" class="sorting" scope="col">사용자 ID <img src="images/icon/arrow_up.png" class="sortImg" /></th>
			<th id ="1" class="sorting" scope="col">사용자 이름 <img src="images/icon/arrow_up.png" class="sortImg" /></th>
			<th id ="2" class="sorting" scope="col">권한 <img src="images/icon/arrow_up.png" class="sortImg" /></th>
			<th id ="3" class="sorting" scope="col">최근 로그인 시간 <img src="images/icon/arrow_up.png" class="sortImg" /></th>
			<th id ="4" class="sorting" scope="col">최근 로그아웃 시간 <img src="images/icon/arrow_up.png" class="sortImg" /></th>
			<th id ="5" class="sorting" scope="col">사용 <img src="images/icon/arrow_up.png" class="sortImg" /></th>
			<th id ="6" class="sorting" scope="col">관리 <img src="images/icon/arrow_up.png" class="sortImg" /></th>
		</tr>
	</table>
</div>
<!-- Title End -->
<!-- List Start -->
<div id="formlist1" class="noborder">
	<table class="sortData liststyle1">
	    <colgroup>
			<col width="100" />
			<col width="" />
			<col width="120" />
			<col width="160" />
			<col width="160" />
			<col width="60" />
			<col width="60" />
	    </colgroup>
	    <c:choose>
	    	<c:when test="${userList != '' && !empty userList}">
				<c:forEach var="list" items="${userList}" varStatus="status">
					<tr class="<c:if test="${list.userId == _prevCode}">selected</c:if> <c:if test="${list.delYn == 'Y'}">tex_selected</c:if>">
						<td scope="col" class="tex_left"><a href="#" onclick="javascript:pmModule.getDetail('${list.userId}','${list.delYn}');">${list.userId}</a></td>
						<td scope="col" class="tex_left"><a href="#" onclick="javascript:pmModule.getDetail('${list.userId}','${list.delYn}');">${list.userNm}</a></td>
						<td scope="col">
						<c:choose>
							<c:when test="${list.userAuth == '7'}">운영관리자</c:when>
							<c:when test="${list.userAuth == '5'}">서브관리자</c:when>
							<c:when test="${list.userAuth == '3'}">일반관리자</c:when>
							<c:otherwise>일반사용자</c:otherwise>
						</c:choose>
						</td>
						<td scope="col">
						<c:choose>
							<c:when test="${list.loginDatetime != '' && !empty list.loginDatetime}">${list.loginDatetime}</c:when>
							<c:otherwise>-</c:otherwise>
						</c:choose>
						</td>
						<td scope="col">
						<c:choose>
							<c:when test="${list.logoutDatetime != '' && !empty list.logoutDatetime}">${list.logoutDatetime}</c:when>
							<c:otherwise>-</c:otherwise>
						</c:choose>
						</td>
						<td scope="col">
						<c:choose>
							<c:when test="${list.useYn == 'Y' && list.delYn == 'N'}"><img src="images/btn/btn_normal02.gif" /></c:when>
							<c:otherwise><img src="images/btn/btn_stop.gif" /></c:otherwise>
						</c:choose></td>
						<td scope="col">
						<c:choose>
							<c:when test="${list.delYn == 'Y'}"><img src="images/btn/btn_restore01.gif" class="clickable" onclick="javascript:pmModule.restore('${list.userId}');" /></c:when>
							<c:otherwise>-</c:otherwise>
						</c:choose>
						</td>
					</tr>
				</c:forEach>
			</c:when>
			<c:otherwise>
				<tr>
					<td id="nodata" colspan="7">- 해당 조건의 검색 내역이 없습니다.</td>
				</tr>			
			</c:otherwise>
	    </c:choose>
	</table>
	<c:if test="${totalCnt > 0}">
		<div class="pagenum" style="clear: both; display: inline;">
			<page:pagelist startRowNo="${_startRowNo}" totalCnt="${totalCnt}" action="portalUserMgmt.action" displyRowCnt="${_pageSize}"></page:pagelist>
		</div>
	</c:if>
</div>
<!-- List End -->
